//
// GPSMapEdit
// (c) Konstantin Galichsky (kg@geopainting.com), 2002-2006
//
// 'About' dialog.
//

# include "StdAfx.h"
# include "Resource.h"
# include "About.h"
# include "LinkDlg.h"
# include "Version.h"
# include "Globals.h"

static
INT_PTR CALLBACK _AboutProc (HWND _hWnd, UINT _uMsg, WPARAM _wParam, LPARAM _lParam) {
	const INT_PTR r = LinkDlgProc (_hWnd, _uMsg, _wParam, _lParam);
	if (r)
		return r;

	switch (_uMsg) {
		case WM_INITDIALOG: {
			// Version.
			char strVersionFmt [256];
			::GetDlgItemText (_hWnd, IDC_VERSION, strVersionFmt, sizeof (strVersionFmt)/sizeof (strVersionFmt [0]));
			char strVersion [256];
			::sprintf (strVersion, strVersionFmt, GME_VER_S);
			::SetDlgItemText (_hWnd, IDC_VERSION, strVersion);

			// Shareware status.
			char strStatusFmt [256];
			::GetDlgItemText (_hWnd, IDC_STATUS, strStatusFmt, sizeof (strStatusFmt)/sizeof (strStatusFmt [0]));
			char strStatus [256];
			::sprintf (strStatus, strStatusFmt, g_bRegistered ? "registered copy" : "not registered");
			::SetDlgItemText (_hWnd, IDC_STATUS, strStatus);

			// The trademarks.
			::SetDlgItemText (
				_hWnd, IDC_TRADEMARKS,
				"ALAN, ALAN Map 500 and ALAN Map 600 are registered trademarks of\r\n"
				"ALAN Group.\r\n"
				"\r\n"
				"ESRI is registered trademark of Environmental Systems Research\r\n"
				"Institute, Inc.\r\n"
				"\r\n"
				"Enhanced Compressed Wavelets (ECW) is trademark of Earth Resource\r\n"
				"Mapping, Ltd.\r\n"
				"\r\n"
				"Garmin and MapSource are registered trademarks or trademarks of\r\n"
				"Garmin Ltd. or one of its subsidiaries.\r\n"
				"\r\n"
				"Google, Google Maps and Google logo are are registered trademarks\r\n"
				"or trademarks of Google Inc.\r\n"
				"\r\n"
				"Holux and MapShow are trademarks or registered trademarks of\r\n"
				"Holux Technology Inc.\r\n"
				"\r\n"
				"Magellan and MapSend are registered trademarks of Thales Navigation.\r\n"
				"\r\n"
				"Navitel Navigator is a trademark of ZAO CNT.\r\n"
				"\r\n"
				"MapInfo is registered trademark of MapInfo Corporation.\r\n"
				"\r\n"
				"All other trademarks or registered trademarks are ones of their\r\n"
				"respective owners.\r\n"
			);
			//::SendDlgItemMessage (_hWnd, IDC_TRADEMARKS, EM_FMTLINES, TRUE, 0);

			return TRUE;
		}

		case WM_COMMAND:
			if (LOWORD (_wParam) == IDCANCEL) {
				// On closing dialog.
				::EndDialog (_hWnd, 0);
				return TRUE;
			}
	}

	return FALSE;
}

void ShowAboutBox (HWND _hWnd) {
	DlgBox (IDD_ABOUTBOX, _hWnd, & _AboutProc);
}
